package Book;

import User.AdminUser;
import User.NormalUser;
import User.User;

import java.util.Scanner;

public class Main {

    public static User func() {
        Scanner scanner = new Scanner(System.in);
        String name;
        System.out.println("请输入姓名：");
        name = scanner.nextLine();
        System.out.println("请选择你的身份 1.管理员身份 2.读者身份");
        int choice = scanner.nextInt();
        if (choice == 1) {
            return new AdminUser(name);
        } else {
            return new NormalUser(name);
        }

    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        BookList bookList = new BookList();
        User user = func();
        while(true){
            user.menu();
            System.out.println("请选择：");
            int choice = scanner.nextInt();
            user.ioperations[choice].work(bookList);
        }
    }
}
